{% if languages|length > 1 %}
  {% if layout is defined and layout == 'list' %}
  <form action="{{ action }}" method="post" enctype="multipart/form-data" class="form-language">
    <div class="btn-group">
      <span class="title">{{ text_language }}</span>
      <ul class="{% if extra_class is defined %} {{extra_class}}{% endif %}">
        {% for language in languages %}
        <li>
          <button class="btn btn-link btn-block language-select" type="button" name="{{ language.code }}"><img src="catalog/language/{{ language.code }}/{{ language.code }}.png" alt="{{ language.name }}" title="{{ language.name }}" /></button>
        </li>
        {% endfor %}
      </ul>
    </div>
    <input type="hidden" name="code" value="" />
    <input type="hidden" name="redirect" value="{{ redirect }}" />
  </form>
  {% else %}
    <div class="pull-right {% if extra_class is defined %} {{extra_class}}{% endif %}">
      <form action="{{ action }}" method="post" enctype="multipart/form-data" class="form-language">
        <div class="btn-group">
          <button class="btn btn-link dropdown-toggle" data-toggle="dropdown">
          {% for language in languages %}
          {% if language.code == code %} 
          <img src="catalog/language/{{ language.code }}/{{ language.code }}.png" alt="{{ language.name }}" title="{{ language.name }}">
          {% endif %}
          {% endfor %}
          <span class="hidden-xs hidden-sm hidden-md" {% if text_link_color %}style="color:{{text_link_color}};"{% endif %}>{{ text_language }}</span>&nbsp;<i class="fa fa-angle-down" {% if button_color %}style="color:{{button_color}};"{% endif %}></i>
          </button>
          <ul class="dropdown-menu dropdown-menu-right">
            {% for language in languages %}
            <li>
              <button class="btn btn-link btn-block language-select" type="button" name="{{ language.code }}"><img src="catalog/language/{{ language.code }}/{{ language.code }}.png" alt="{{ language.name }}" title="{{ language.name }}" /> {{ language.name }}</button>
            </li>
            {% endfor %}
          </ul>
        </div>
        <input type="hidden" name="code" value="" />
        <input type="hidden" name="redirect" value="{{ redirect }}" />
      </form>
    </div>
  {% endif %}  
{% endif %}

